package com.dream.controller;

import com.dream.entity.ResponseResult;
import com.dream.util.JwtTokenUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/loginImage")
public class ImageCodeController {

    @GetMapping("/imageCode")
    public ResponseResult<String> imageCode(HttpServletRequest request) {
        //生成验证码
        String sessionKey = "";
        //存入到session中
        request.getSession().setAttribute(JwtTokenUtils.KAPTCHA_SESSION_KEY, sessionKey);
        //返回验证码
        return ResponseResult.success("生成验证码成功", sessionKey);
    }
}
